package org.example.two.sort;

import org.example.two.Example;

/**
 * 选择排序算法
 * @outher 刘旭
 * @date 2024/4/30 9:29
 */
public class Selection extends Example {
    @Override
    public  void sort(Comparable[] a) {
        int len = a.length;
        for (int i = 0; i < len; i++) {
            for (int j = i; j < len; j++) {
                if (les(a[j],a[i])){
                    exch(a,i,j);
                }
            }
        }
    }
}
